#ifndef MARQUEETVIEW_H
#define MARQUEETVIEW_H

#include "viewobject.h"
#include "paramobject.h"
#include <QLabel>
#include <QMovie>
#include <qdom.h>
#include <QTimer>

//跑马灯显示组件
/*********
time_ms：超时时间（切换资源的时间）
startIndex：初始位置的数组索引值
endIndex：结束位置的数组索引值
positioninfo：所有位置的坐标数组
url：使用的资源名称
**********/

typedef struct MarqueeViewParam
{
    int             m_timeMS;
    int             m_startIndex;
    int             m_endIndex;
    QString         m_res;
    QString         m_positionInfo;
    MarqueeViewParam()
    {
        m_timeMS = -1;
        m_startIndex = -1;
        m_endIndex = -1;
        m_res = "";
        m_positionInfo = "";
    }
}MarqueeViewParam;

typedef struct PositionInfo
{
    int     w;
    int     h;
    int     x;
    int     y;
    PositionInfo()
    {
        w = -1;
        h = -1;
        x = -1;
        y = -1;
    }
}PositionInfo;

class MarqueeView : public ViewObject
{
    Q_OBJECT
public:
    static int m_id;
    Q_INVOKABLE explicit MarqueeView(QWidget *parent = 0);
    ~MarqueeView();

    void ShowObject(QWidget*, QString filename = "", QString prefix = "", ProtocolData *ptr_data = NULL);

    void HideObject();

    void DestoryObject();

    void GetAttribute(std::string&);

    void SetAttribute(std::string);

    void ParseXML(QDomElement* );

    void PacketXML(QDomElement*);

public slots:
    void TimeOutSlot();

private:
    int                                 m_indexCurrent;
    bool                                m_changeLabelshow;
    QTimer*                             m_timer;
    QLabel*                             m_label;
    QMovie*                             m_movie;
    QMap<int, PositionInfo>             m_mapPosition;
    MarqueeViewParam*                   m_marqueeViewParam;
};

#endif // TIMEOUTVIEWOBJECT_H
